﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AppFabricAdministrator
{
    public partial class TestGet: UserControl
    {
        public TestGet()
        {
            InitializeComponent();
        }

        private void btnGet_Click(object sender, EventArgs e)
        {
            string key = tbKey.Text;

            if (string.IsNullOrWhiteSpace(key))
            {
                MessageBox.Show("Key name can not be empty");
            }
            else
            {
                var namedCache = TestCache.Current.NamedCacheControl.SelectedNamedCache;
                var value =CacheHelper.GetNamedCache(namedCache).Get(key);
                if (value != null)
                {
                    TestCache.Current.PublishResult("Value:{0}", value.ToString());
                }
                else
                    TestCache.Current.PublishResult("Key doesnot exists in selected named cache");
            }
        }
    }
}
